package cn.uestc.labhms.modules.hms.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.uestc.labhms.modules.hms.entity.InspectInfoEntity;
import cn.uestc.labhms.modules.hms.service.InspectInfoService;
import cn.uestc.labhms.common.utils.PageUtils;
import cn.uestc.labhms.common.utils.R;



/**
 * 
 *
 * @author Mu.tz
 * @email Mutz@gmail.com
 * @date 2021-11-01 20:33:41
 */
@RestController
@RequestMapping("hms/inspectinfo")
public class InspectInfoController {
    @Autowired
    private InspectInfoService inspectInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("hms:inspectinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = inspectInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{inspectId}")
    @RequiresPermissions("hms:inspectinfo:info")
    public R info(@PathVariable("inspectId") String inspectId){
		InspectInfoEntity inspectInfo = inspectInfoService.getById(inspectId);

        return R.ok().put("inspectInfo", inspectInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("hms:inspectinfo:save")
    public R save(@RequestBody InspectInfoEntity inspectInfo){
		inspectInfoService.save(inspectInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("hms:inspectinfo:update")
    public R update(@RequestBody InspectInfoEntity inspectInfo){
		inspectInfoService.updateById(inspectInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("hms:inspectinfo:delete")
    public R delete(@RequestBody String[] inspectIds){
		inspectInfoService.removeByIds(Arrays.asList(inspectIds));

        return R.ok();
    }

}
